package org.iris.wiki

import net.mamoe.mirai.contact.Member
import org.iris.wiki.config.CommonConfig
import org.iris.wiki.data.Data
import org.iris.wiki.action.Draw
import org.iris.wiki.action.Question
import org.iris.wiki.config.CommandConfig
import org.iris.wiki.data.ImagesData
import org.iris.wiki.data.TextData
import org.iris.wiki.utils.DrawUtils
import org.iris.wiki.utils.ParserUtils

/**
 * 用于对搜索的词进行检测，过滤掉一些特殊意义的词汇
 */
object Checker {

    fun check(commandList: Array<String>, sender: Member) : Data? {
        when {
            commandList[1] in listOf("锉刀", "锉宝", "挫刀", "小锉锉") -> {
                // 锉宝可是要生气了
                return ImagesData(arrayListOf("${CommonConfig.emoji_path}/cuodao_${(1..4).random()}.jpg")).activateAt()
            }
            commandList[1] in listOf("偷天雷", "偷") -> {
                // 偷天雷
                return ImagesData(arrayListOf("${CommonConfig.emoji_path}/toutianlei_${(1..5).random()}.jpg")).activateAt()
            }
            commandList[1] in listOf("小涩", "小色", "涩图哥", "涩图弟", "色图哥", "色图弟") -> {
                return ImagesData(arrayListOf("${CommonConfig.emoji_path}/wiki_iris.jpg")).activateAt()
            }
            commandList[1] in listOf("蝶梦影", "梦影", "梦神") -> {
                return TextData("天不生我蝶梦影，碧蓝万古如长夜").activateAt()
            }
            commandList[1] in listOf("雪小梦") -> {
                return TextData("我是机器人，不是游戏里的角色啦").activateAt()
            }
            commandList[1] in listOf("云时") -> {
                return ImagesData(arrayListOf("${CommonConfig.emoji_path}/yunshi.jpg")).activateAt()
            }
            commandList[1] in listOf("朔夜") -> {
                return ImagesData(arrayListOf("${CommonConfig.emoji_path}/shuoye.jpg")).activateAt()
            }
            commandList[1] in listOf("咩咩") -> {
                return ImagesData(arrayListOf("${CommonConfig.emoji_path}/miemie.jpg")).activateAt()
            }
            commandList[1] in listOf("大叔") -> {
                return ImagesData(arrayListOf("${CommonConfig.emoji_path}/dashu.jpg")).activateAt()
            }
            commandList[1] in listOf("高远山","山神") -> {
                return ImagesData(arrayListOf("${CommonConfig.emoji_path}/gaoyuanshan.jpg")).activateAt()
            }
            commandList[1] in listOf("丁真","东雪莲") -> {
                return TextData("我是wiki查询辅助工具，写群友的名字是彩蛋，不要查这些乱七八糟的东西。")
            }
            commandList[1] in listOf("胡腾","北安普顿","北安普顿2","北安普顿II","忒休斯","花甲","冤仇","安定","阿布鲁奇","阿布鲁奇公爵") -> {
                return TextData("错别字不在外号范围内，无法查询").activateAt()
            }
            commandList[1] in listOf("he50b","he-50b","he-50b舰载轰炸机","ar195","ar-195","ar-195舰载鱼雷机","fi167","fi-167","fi-167舰载鱼雷机") -> {
                return TextData("最前面的He-50B开铁血箱子（伯鲁克），蓝紫均可。中间这些飞机都是过渡产物，无实战意义也无其他出处").activateAt()
            }
            commandList[1] in listOf("航母装填","航母命中","战列装填","战列命中","科技点") -> {
                return TextData("群公告有科技点表格（腾讯文档）的链接，请自行查看").activateAt()
            }
            commandList[1] in listOf("嘉然", "然然") -> {
                return if (commandList.size == 3 && commandList[2] in listOf("评价")) {
                    TextData("我的评价是神中神，世界第一小草莓！")
                } else {
                    if ((1..5).random() > 2) {
                        ImagesData(arrayListOf("${CommonConfig.emoji_path}/jiaran_${(1..3).random()}.jpg")).activateAt()
                    } else {
                        ImagesData(arrayListOf("${CommonConfig.emoji_path}/jiaran_${(1..6).random()}.gif")).activateAt()
                    }
                }
            }
            commandList.size > 2 && commandList[2] in listOf("语音", "[语音]") ->{
                return TextData(CommandConfig.voiceList)
            }
            else -> {
                return null
            }
        }
    }

}
